using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OracleClient;

using DQS.EL;

namespace DQS.DAL
{
    public static class DQ_COLUMNSService
    {
        public static IList<DQ_COLUMNS> GetColumnsByTableID(int argId)
        {
            IList<DQ_COLUMNS> _objs = new List<DQ_COLUMNS>();
            String sqlStr = "SELECT UI_COL,COL_ID,COL_STATUS FROM DQ_Columns " 
                + " WHERE TABLE_ID = :TABLE_ID AND COL_STATUS IN ('0','1') ORDER BY order_num";
            OracleParameter[] _param ={
			    new OracleParameter(":TABLE_ID",OracleType.Number)
			};
            _param[0].Value = argId;
            using (OracleDataReader odr = OracleHelper.ExecuteReader(sqlStr, CommandType.Text, _param))
            {
                while (odr.Read())
                {
                    DQ_COLUMNS _obj = new DQ_COLUMNS();
                    _obj.UI_COL = odr.GetString(0);
                    _obj.COL_ID = odr.GetDecimal(1);
                    _obj.COL_STATUS = odr.GetString(2);
                    _objs.Add(_obj);
                }
            }
            return _objs;
        }
    }
}
